package com.starwish.starwishblog.mapper;

import com.starwish.starwishblog.entity.Board;
import com.starwish.starwishblog.vo.BoardVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface BoardMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Board record);

    Board selectByPrimaryKey(Integer id);

    List<Board> selectAll();



    int updateByPrimaryKey(Board record);

/*====================自写区域==============================*/
    //逻辑删除---
    int deleteById(Integer id);

    //推荐热门板块---
    int hotById(@Param("id") Integer id,@Param("status") Integer status);

    //根据板块名称条件查询---
    List<Board> selectBoardByCons(@Param("name") String name);
    List<BoardVo> selectAllBoards();

    @Select("select b.name from sw_category c inner join sw_board b on c.board_id = b.id where c.id = #{categoryId} ")
    String selectByCateId(Integer categoryId);
}